import telnetlib
import argparse

class Switch:
	def __init__(self, ip, username, password):
		self.ip = ip
		self.username = username
		self.password = password
	def connect(self):
		self.tel = telnetlib.Telnet(self.ip)
		self.tel.read_until('Username')
		self.tel.write(self.username + '\n')
		self.tel.read_until('Password')
		self.tel.write(self.password + '\n')
		self.tel.read_until('>')
	def send(self, cmd):
		self.tel.write(cmd)
	def opench(self, ch):
		self.send()
	def closech(self, ch):
		self.send()
def main(config):
	pass
if __name__=="__main__":
	with open('./config.json','r') as ipt:
        configs = json.load(ipt)
	config = configs['3']
	switch = Switch(config['ip'], config['username'], config['password'])
	switch.connect()
	

